import React from 'react';
import { utils } from '@ohif/core';
import commandsModule from './commandsModule.js';
import toolbarModule from './toolbarModule.js';
import withCommandsManager from './withCommandsManager.js';
import { version } from '../package.json';
import loadLocales from './loadLocales';

const OHIFVTKViewport = utils.asyncComponent(React.lazy(() => import('./OHIFVTKViewport.js')));

const vtkVrExtension = {
  /**
   * Only required property. Should be a unique value across all extensions.
   */
  id: 'vtk-vr',
  version,

  getViewportModule({ commandsManager, servicesManager }) {
    const ExtendedVTKViewport = props => (
      <OHIFVTKViewport {...props} servicesManager={servicesManager} />
    );
    return withCommandsManager(ExtendedVTKViewport, commandsManager);
  },
  getToolbarModule() {
    return toolbarModule;
  },
  getCommandsModule({ commandsManager }) {
    return commandsModule({ commandsManager });
  },
};

export default vtkVrExtension;

export { vtkVrExtension };

loadLocales();
